import request from './fetch'

/**
 * 发送通知
 */
export const sendNoti = data => {
  return request({
    name: '发送通知',
    url: '/api/v1/noti',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

/**
 * 直播设备信息查询
 */
export const fetchDeviceInfo = data => {
  return request({
    name: '查询设备信息',
    url: '/api/v1/live/device/info',
    data
  })
}

/**
 * 开播/重启直播
 */
export const startLive = (data, isRestart) => {
  return request({
    name: isRestart ? '重启直播' : '开播',
    url: '/api/v1/live/audio/start-live',
    data: {
      ...data,
      type: 'VIDEO'
    }
  })
}

/**
 * 关闭直播
 */
export const stopLive = data => {
  return request({
    name: '关闭直播',
    method: 'post',
    url: '/api/v1/live/audio/stop',
    data
  })
}

/**
 * 获取下一次播放的插播视频数据
 */
export const fetchNextVideo = data => {
  return request({
    name: '查询下一次播放视频数据',
    url: '/api/v1/live/audio/next-video',
    data
  })
}
